# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-user-agents
pkgname=('python2-user-agents' 'python-user-agents')
_pkgname=user-agents
pkgver=2.2.0
pkgrel=6
pkgdesc='A library to identify devices (phones, tablets) and their capabilities by parsing (browser/HTTP) user agent strings.'
url='https://pypi.org/project/user-agents/#files'
arch=('any')
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('39d17acdb75e0e4e7520b584794db1d07babd98f25e0cb75e9667733897c30610f03b350b93da6938d96317ebe417e7368d794ee7aa134fbba52ac8ab0124aa8')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-user-agents() {
  depends=('python2' 'python2-ua-parser')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-user-agents() {
  depends=('python' 'python-ua-parser')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

